<template>
  <view>
    <u-navbar :background="{ background: '#fff' }" back-icon-color="#222222" title-color="#222222" title="全部公告" :border-bottom="false"></u-navbar>
    <view class="" style="margin: 20rpx 28rpx; background: #fff; border-radius: 20rpx" v-for="(i, k) in list" :key="k">
      <view
        class=""
        style="
          font-size: 28rpx;
          padding: 41rpx 35rpx 34rpx 27rpx;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
          display: -webkit-box;
        "
      >
        公告：{{ i.content }}
      </view>
      <view class="" style="display: flex; align-items: center; justify-content: space-between; padding: 0 25rpx 36rpx">
        <view class="" style="font-size: 26rpx; color: #999999">
          {{ i.create_time_text }}
        </view>
        <view class="" style="font-size: 26rpx; color: #1a9eff" @tap="lookall(i.notice_id)">查看全文</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: '',
  data() {
    return {
      id: null,
      page: 1,
      list: []
    };
  },
  //方法
  methods: {
    lookall(e) {
      uni.navigateTo({
        url: '/home/gongdetail/gongdetail?id=' + e
      });
    },
    detail() {
      this.api({
        url: '/api/doctor/noticeList',
        method: 'post',
        data: {
          doctor_id: this.id,
          page: this.page
        }
      }).then((res) => {
        this.list = this.list.concat(res.data);
        this.page++;
      });
    }
  },
  //首页渲染
  onLoad(options) {
    this.id = options.id;
  },
  onShow() {
    this.detail();
  },
  //监听
  watch: {},
  //计算属性
  computed: {}
};
</script>

<style lang="scss" scoped>
page {
  background: #f8f8f8;
}
</style>
